# Maintainer: gym603 <gui_yuan_miao@163.com>

_realname=ordereddict
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python2-${_realname}")
pkgver=1.1
pkgrel=1
pkgdesc="A drop-in substitute for Py2.7's new collections.OrderedDict that works in Python 2.4-2.6. (mingw-w64)"
arch=('any')
url="https://pypi.org/project/ordereddict"
license=('custom')
_dtoken="53/25/ef88e8e45db141faa9598fbf7ad0062df8f50f881a36ed6a0073e1572126"
_archive=${_realname/_/-}-${pkgver}
source=(${_archive}.tar.gz::https://files.pythonhosted.org/packages/${_dtoken}/${_archive}.tar.gz)
sha256sums=('1C35B4AC206CEF2D24816C89F89CF289DD3D38CF7C449BB3FAB7BF6D43F01B1F')

_deps2=()
makedepends=("${MINGW_PACKAGE_PREFIX}-python2-setuptools")

build() {
  cd "${srcdir}"
  rm -rf python2-build
  for builddir in python2-build; do
    msg2 "Building for ${CARCH} ${builddir%-build} ..."
    cp -r ${_archive} ${builddir}
    pushd $builddir
    ${MINGW_PREFIX}/bin/${builddir%-build} setup.py --quiet build
    popd
  done
}

package_python2-ordereddict() {
  depends=("${MINGW_PACKAGE_PREFIX}-python2" "${_deps2[@]/#/${MINGW_PACKAGE_PREFIX}-python2-}")

  cd "${srcdir}/python2-build"
  MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
    ${MINGW_PREFIX}/bin/python2 setup.py --quiet install --prefix=${MINGW_PREFIX} --root="${pkgdir}" -O1

  install -Dm644 LICENSE "${pkgdir}${MINGW_PREFIX}/share/licenses/python2-${_realname}/LICENSE"
}

package_mingw-w64-i686-python2-ordereddict() {
  package_python2-${_realname}
}

package_mingw-w64-x86_64-python2-ordereddict() {
  package_python2-${_realname}
}
